/**
 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_CODE_GENERATOR_COMPILER_BASE_TYPES_H
#define PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_CODE_GENERATOR_COMPILER_BASE_TYPES_H
#include "compiler/optimizer/code_generator/encode.h"
#include "source_languages.h"

namespace ark::compiler {

class Inst;
class CompareAnyTypeInst;
class CastAnyTypeValueInst;
class CastValueToAnyTypeInst;
class AnyTypeCheckInst;
class GetAnyTypeNameInst;
template <size_t N>
class FixedInputsInst;
class EncodeVisitor;
class HclassCheckInst;

namespace ecmascript {

bool CompareAnyTypeGen(const CompareAnyTypeInst *cati, EncodeVisitor *encV);
bool CastAnyTypeValueGen(const CastAnyTypeValueInst *cati, EncodeVisitor *encV);
bool CastValueToAnyTypeGen(const CastValueToAnyTypeInst *cvai, EncodeVisitor *encV);
bool AnyTypeCheckGen(AnyTypeCheckInst *checkInst, EncodeVisitor *encV);
bool ObjByIndexCheckGen(const FixedInputsInst<2> *checkInst, EncodeVisitor *encV, LabelHolder::LabelId id);
bool DynamicCallCheckGen(FixedInputsInst<2> *checkInst, EncodeVisitor *encV);
bool LoadConstantPoolGen(const Inst *inst, EncodeVisitor *encV);
bool LoadLexicalEnvGen(const Inst *inst, EncodeVisitor *encV);
bool GetAnyTypeNameGen(const GetAnyTypeNameInst *inst, EncodeVisitor *encV);
bool HclassCheckGen(HclassCheckInst *checkInst, EncodeVisitor *encV);
bool IsDynHeapObject(AnyBaseType type);

}  // namespace ecmascript
}  // namespace ark::compiler

#endif  // PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_CODE_GENERATOR_COMPILER_BASE_TYPES_H
